﻿using UnityEngine;
using System.Collections;

public class GameController : MonoBehaviour {

	public GameObject canvas1;
	public GameObject canvas2;
	public GameObject canvas_home;

	public void OnPlayClick()
	{
		//显示canvas2
		canvas1.GetComponent<Canvas> ().enabled = false;
		canvas2.GetComponent<Canvas> ().enabled = true;
	}

	public void OnBackClick()
	{
		//显示canvas1
		canvas1.GetComponent<Canvas> ().enabled = true;
		canvas2.GetComponent<Canvas> ().enabled = false;
	}

	public void OnChineseClick()
	{
		Localization.language = "Chinese";
		//本地存储中language字段为中文
		PlayerPrefs.SetString("language", "Chinese");
		//发送广播 ，更改文本
		canvas_home.BroadcastMessage ("TextLocalizationChange");
	}

	public void OnEnglishClick()
	{
		Localization.language = "English";
		PlayerPrefs.SetString("language", "English");
		canvas_home.BroadcastMessage ("TextLocalizationChange");
	}
}
